package com.dkd.manage.mapper;

import com.dkd.manage.annotation.AutoFill;
import com.dkd.manage.constant.OperationType;
import com.dkd.manage.pojo.dto.VmQueryListDto;
import com.dkd.manage.pojo.entity.VendingMachine;
import com.dkd.manage.pojo.vo.VendingMachineVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VmMapper {


    /**
     * 分页查询设备列表
     * @param vmQueryListDto
     * @return
     */
    List<VendingMachineVo> list(VmQueryListDto vmQueryListDto);


    /**
     * 新增设备
     * @param vendingMachine
     * @return
     */
    @AutoFill(OperationType.INSERT)
    Integer add(VendingMachine vendingMachine);

    /**
     * 修改设备
     * @param vendingMachine
     * @return
     */
    @AutoFill(OperationType.UPDATE)
    Integer edit(VendingMachine vendingMachine);

    /**
     * 根据id删除设备
     * @param ids
     * @return
     */
    Integer deleteVmById(@Param("ids") Long[] ids);

    /**
     * 根据id查询设备
     * @param id
     * @return
     */
    @Select("select id, inner_code, channel_max_capacity, node_id, addr, last_supply_time, business_type, " +
            "region_id, partner_id, vm_type_id, vm_status, running_status, longitudes, latitude, client_id, " +
            "policy_id, create_time, update_time, create_by, update_by from tb_vending_machine where id = #{id}")
    VendingMachine getVmById(Long id);

}
